<template>
  <el-select :size="size" style="width:100%;" v-model="inputValue" placeholder="请选择">
    <el-option
      v-for="item in list"
      :key="item.value"
      :label="item.name"
      :value="item.value">
    </el-option>
  </el-select>
</template>

<script>
import {listByType} from '@/api/dict'

export default {
  props: {
    type: {
      default: ''
    },
    value: {
      default: ''
    },
    size: {
      default: 'small'
    }
  },
  data() {
    return {
      list: []
    }
  },
  computed: {
    inputValue: {
      get() {
        return this.value
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  watch: {},
  methods: {
    loadList() {
      listByType(this.type).then(res => {
        this.list = res.result
      })
    }
  },
  mounted() {
    this.loadList()
  }
}
</script>

<style scoped>

</style>
